package top.eggcode.component.query.predicate;

import top.eggcode.component.query.model.Expression;

import java.util.List;

public class NegatedPredicateWrapper extends AbstractPredicateImpl {

    private final SimplePredicate predicate;

    public NegatedPredicateWrapper(SimplePredicate predicate) {
        this.predicate = predicate;
    }

    @Override
    public boolean isNegated() {
        return true;
    }

    @Override
    public String render() {
        return render(isNegated());
    }

    @Override
    public String render(boolean isNegated) {

        if (isJunction()) {
            // CompoundPredicate
            return predicate.render();
        } else {
            return predicate.render(isNegated);
        }
    }

    @Override
    public List<Expression<Boolean>> getExpressions() {
        return null;
    }
}
